﻿using SimplyCleverMiddleTier;
using System.Linq;
using System.Web.Mvc;

namespace MvcSimplyCleverPart1
{
    public static class ViewHelper
    {

        public static SelectList GetStates(string stateCode)
        {

            var states = CountryProvider.GetUSStates();

            if (string.IsNullOrEmpty(stateCode))
                stateCode =states.First().Key;

            SelectList stateList = new SelectList(states, "Key", "Value", stateCode);

            return stateList;
        }
    }
}